
package hackathon.techbooster.tanabata;

import java.io.File;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.InflateException;
import android.widget.Toast;

public class DetailActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try {
            setContentView(R.layout.detail);

            // String id = getIntent().getStringExtra(PreferenceUtils.KEY_ID);
            String name = getIntent().getStringExtra(PreferenceUtils.KEY_NAME);
            String hope = getIntent().getStringExtra(PreferenceUtils.KEY_HOPE);
            int bgResId = getIntent().getIntExtra(PreferenceUtils.KEY_BACK_RES, -1);

            VNameTextView txtName = (VNameTextView) findViewById(R.id.nameView);
            VTextView txtHope = (VTextView) findViewById(R.id.hopeView);

            txtName.setText(name);
            txtHope.setText(hope);
            findViewById(R.id.layoutView).setBackgroundResource(bgResId);
        } catch (InflateException e) {
            File file = PreferenceUtils.getFontFile(this);
            file.delete();

            Toast.makeText(this, R.string.error_font, Toast.LENGTH_LONG).show();
            finish();
        }

    }
}
